const Router = require("koa-router");

const {
  findAll,
  findTypeByid,
  update,
  remove,
  create,
  findAllType,
} = require("../controller/type.controller");
const { auth, hadAdminPermission } = require("../middleware/auth.middleware");
const router = new Router({ prefix: "/types" });

// 修改
router.put("/update/:id", auth, hadAdminPermission, update);

// 删除
router.delete("/:id", auth, hadAdminPermission, remove);

// 获取列表
router.post("/list", findAll);

// 获取列表
router.get("/all", findAllType);

// 新增
router.post("/", auth, hadAdminPermission, create);
// 获取详情
router.get("/:id", auth, findTypeByid);
module.exports = router;
